﻿<Page
    x:Class="JarvisProject1.RubricPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:JarvisProject1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
    <Page.Resources>
        <CollectionViewSource x:Name="cvs2" IsSourceGrouped="true" />
        <CollectionViewSource x:Name="cvs3" IsSourceGrouped="true" />
    </Page.Resources>

    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="666*"/>
            <ColumnDefinition Width="17*"/>
        </Grid.ColumnDefinitions>
        <Grid.Background>
            <ImageBrush ImageSource="Assets/Fon22.png"/>
        </Grid.Background>
        <!--Блок cообщения-->


        <!--Блок список рубрик-->
        <Grid x:Name="List_of_rubrics" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}" HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="405" Visibility="Visible">

            <ListView 
                x:Name="RubricaName" 
                ItemsSource="{Binding Source={StaticResource cvs2}}"
                Margin="32,199,0,110" 
                HorizontalAlignment="Left"
                Width="349" IsSynchronizedWithCurrentItem="False" SelectionChanged="RubricaName_SelectionChanged" SelectedIndex="-1">
                
                <ListView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Vertical"/>
                    </ItemsPanelTemplate>
                </ListView.ItemsPanel>
                <ListView.ItemTemplate>
                    <!--вид блока с изображением и названием рубрики-->
                    <DataTemplate>
                        <Grid HorizontalAlignment="Left" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}" Visibility="Visible" Width="430">
                            <StackPanel Orientation="Horizontal" Margin="10,10,0,0">
                                <Image Source="{Binding Image}" Stretch="Uniform"  Height="60" Width="60" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                <StackPanel Margin="0,0,0,0" Orientation="Vertical">
                                    <TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Style="{StaticResource ItemTitleStyle}" Width="200" VerticalAlignment="Center" Text="{Binding Title}" HorizontalAlignment="Left" FontFamily="Segoe UI" />
                                    <TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Style="{StaticResource ItemSubtitleStyle}" Width="200" MaxHeight="20" VerticalAlignment="Center" Text="{Binding Category}" HorizontalAlignment="Left"/>
                                </StackPanel>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </ListView.ItemTemplate>
                <!--вид групп-->
                <ListView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Grid Background="{x:Null}" Margin="10">
                                    <TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" FontSize="25" Margin="5" />
                                </Grid>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>
                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <VariableSizedWrapGrid Orientation="Vertical"/>
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </ListView.GroupStyle>
            </ListView>
            <TextBox HorizontalAlignment="Left" Height="0" Margin="32,140,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="331" BorderBrush="{x:Null}"/>
            <Button x:Name="Show_Rubrics" Style="{StaticResource NextAppBarButtonStyle}" AutomationProperties.Name="Рубрики"  Margin="290,648,0,27" Width="91" Click="Show_Rubrics_Click"/>
            <Button x:Name="Add_Rubric" Style="{StaticResource AddAppBarButtonStyle}" AutomationProperties.Name="Добавить рубрику"  Margin="32,648,0,10" Width="95" Click="Add_Rubric_Click_1"/>
            <Button x:Name="Add_message" Style="{StaticResource AddAppBarButtonStyle}" AutomationProperties.Name="Добавить сообщение"  Margin="154,648,0,20" Width="95" Click="Add_message_Click_1"/>
            <Image HorizontalAlignment="Left" Height="64" Margin="-99,29,-20,0" VerticalAlignment="Top" Width="524" Source="Assets/logorubricsnew.png"/>
            <Button Style="{StaticResource PreviousAppBarButtonStyle}" HorizontalAlignment="Left" Height="87" Margin="0,29,0,0" VerticalAlignment="Top" Width="91" AutomationProperties.Name="" Click="Button_Click_1"/>
        </Grid>

        <!--Блок страница рубрик-->
        <!--Сообщения в рубрике-->
        <Grid x:Name="Messages_in_thisRubrica" Height="768" VerticalAlignment="Top"  Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}" ScrollViewer.VerticalScrollBarVisibility="Visible"  Margin="425,0,170,0">

            <Line X1="5" Y1="00" X2="5" Y2="770" Stroke="White"></Line>
            <Line X1="300" Y1="220" X2="710" Y2="220" Stroke="White"></Line>
            
            <Grid x:Name="ContentPanel2" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="71,237,0,0">
                <SemanticZoom x:Name="semanticZoom2" VerticalAlignment="Bottom" Margin="0,0,11,0">
                    <!--выход из зума-->
                    <SemanticZoom.ZoomedOutView>
                        <GridView ScrollViewer.IsHorizontalScrollChainingEnabled="False">
                            <GridView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock
        									Text="{Binding Group.Key}"
        									FontFamily="Segoe UI Light"
        									FontSize="24"/>
                                </DataTemplate>
                            </GridView.ItemTemplate>
                            <GridView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapGrid ItemWidth="75" ItemHeight="75" MaximumRowsOrColumns="5" VerticalChildrenAlignment="Center" />
                                </ItemsPanelTemplate>
                            </GridView.ItemsPanel>
                            <GridView.ItemContainerStyle>
                                <Style TargetType="GridViewItem">
                                    <Setter Property="Margin" Value="4" />
                                    <Setter Property="Padding" Value="10" />
                                    <Setter Property="BorderBrush" Value="Gray" />
                                    <Setter Property="BorderThickness" Value="1" />
                                    <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    <Setter Property="VerticalContentAlignment" Value="Center" />
                                </Style>
                            </GridView.ItemContainerStyle>
                        </GridView>
                    </SemanticZoom.ZoomedOutView>
                    <!--вход в зум-->
                    <SemanticZoom.ZoomedInView>
                        <GridView
                            x:Name="ItemsByLetter2" 
                            VerticalAlignment="Bottom" 
        					ItemsSource="{Binding Source={StaticResource cvs3}}" 
                            Grid.Row="1"
                            IsSynchronizedWithCurrentItem="False"
                            SelectionChanged="ItemsByLetter2_SelectionChanged">
                            <GridView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </GridView.ItemsPanel>
                            <GridView.ItemTemplate>
                                <DataTemplate>
                                    <Grid HorizontalAlignment="Left" Width="120" Height="120">
                                        <StackPanel Orientation="Horizontal" Margin="0,0,0,0">
                                            <Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
                                                <Image Source="{Binding Image}" Stretch="UniformToFill"  Height="130" Width="130" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                            </Border>
                                        </StackPanel>
                                        <StackPanel  VerticalAlignment="Bottom"  Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}" Height="43">
                                            <TextBlock  Text="{Binding Title}" Style="{StaticResource TitleTextStyle}" Margin="15,0,15,0" FontFamily="Segoe UI" />
                                            <TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Style="{StaticResource ItemSubtitleStyle}" Width="200" MaxHeight="20" VerticalAlignment="Center" Text="{Binding Category}" HorizontalAlignment="Left"/>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </GridView.ItemTemplate>
                            <GridView.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <Grid Background="{x:Null}" Margin="10">
                                                <TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" FontSize="25" Margin="5" />
                                            </Grid>
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                    <GroupStyle.Panel>
                                        <ItemsPanelTemplate>
                                            <VariableSizedWrapGrid Orientation="Vertical" Height="400" />
                                        </ItemsPanelTemplate>
                                    </GroupStyle.Panel>
                                </GroupStyle>
                            </GridView.GroupStyle>
                            <Button Visibility="Collapsed"/>
                        </GridView>
                    </SemanticZoom.ZoomedInView>
                </SemanticZoom>
            </Grid>
            <TextBlock x:Name="NameRubric" HorizontalAlignment="Left" Height="69" Margin="203,46,0,0" TextWrapping="Wrap" Text="Наименование рубрики" VerticalAlignment="Top" Width="326" FontSize="28" FontFamily="BrowalliaUPC" Opacity="0.8" TextAlignment="Right"/>
            <Image HorizontalAlignment="Left" Height="162" Margin="545,36,0,0" VerticalAlignment="Top" Width="164" Source="Assets/Avatar.png" Stretch="Fill"/>
            <TextBlock HorizontalAlignment="Left" Height="23" Margin="239,115,0,0" TextWrapping="Wrap" Text="Автор: Мухаметзянов Альберт" VerticalAlignment="Top" Width="290" FontSize="14" FontFamily="BrowalliaUPC" Opacity="0.8" TextAlignment="Right"/>
            <TextBlock HorizontalAlignment="Left" Height="17" Margin="373,159,0,0" TextWrapping="Wrap" Text="Дата: 05.04.2013" VerticalAlignment="Top" Width="156" FontSize="14" FontFamily="BrowalliaUPC" Opacity="0.8" TextAlignment="Right"/>
            <TextBlock HorizontalAlignment="Left" Height="18" Margin="388,180,0,0" TextWrapping="Wrap" Text="Рейтинг: 185" VerticalAlignment="Top" Width="141" FontSize="14" FontFamily="BrowalliaUPC" Opacity="0.8" TextAlignment="Right"/>
            <TextBlock x:Name="CounMessage" HorizontalAlignment="Left" Height="21" Margin="373,138,0,0" TextWrapping="Wrap" Text="Кол-во сообщений: 3" VerticalAlignment="Top" Width="156" FontSize="14" FontFamily="BrowalliaUPC" Opacity="0.8" TextAlignment="Right"/>
        </Grid>
        <Grid 
            x:Name="Rubrics"
            Height="620"
            VerticalAlignment="Top"
            ScrollViewer.VerticalScrollBarVisibility="Visible"
            Margin="0,125,0,0" 
            Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}" Grid.ColumnSpan="2" Visibility="Collapsed">

            <Line X1="1270" Y1="20" X2="1270" Y2="600" Stroke="White"></Line>
            <Line X1="110" Y1="20" X2="110" Y2="600" Stroke="White"></Line>

            <Grid 
                x:Name="ContentPanel"
                VerticalAlignment="Top" 
                HorizontalAlignment="Left"
                Margin="127,73,0,0">
                
                <SemanticZoom x:Name="semanticZoom" VerticalAlignment="Bottom" Margin="0,0,11,0">
                    <!--выход из зума-->
                    <SemanticZoom.ZoomedOutView>
                        <GridView>
                            <!-- ScrollViewer.IsHorizontalScrollChainingEnabled="False">-->
                            <GridView.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock
        								Text="{Binding Group.Key}"
        								FontFamily="Segoe UI Light"
        								FontSize="24"/>
                                </DataTemplate>
                            </GridView.ItemTemplate>
                            <GridView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapGrid ItemWidth="75" ItemHeight="75" MaximumRowsOrColumns="5" VerticalChildrenAlignment="Center" />
                                </ItemsPanelTemplate>
                            </GridView.ItemsPanel>
                            <GridView.ItemContainerStyle>
                                <Style TargetType="GridViewItem">
                                    <Setter Property="Margin" Value="4" />
                                    <Setter Property="Padding" Value="10" />
                                    <Setter Property="BorderBrush" Value="Gray" />
                                    <Setter Property="BorderThickness" Value="1" />
                                    <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    <Setter Property="VerticalContentAlignment" Value="Center" />
                                </Style>
                            </GridView.ItemContainerStyle>
                        </GridView>
                    </SemanticZoom.ZoomedOutView>
                    <!--вход в зум-->
                    <SemanticZoom.ZoomedInView>
                        <GridView
                            x:Name="ItemsByLetter" 
                            VerticalAlignment="Bottom" 
        					ItemsSource="{Binding Source={StaticResource cvs2}}"
                            IsSynchronizedWithCurrentItem="False" SelectionChanged="ItemsByLetter_SelectionChanged">
                            
                            <GridView.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel Orientation="Horizontal"/>
                                </ItemsPanelTemplate>
                            </GridView.ItemsPanel>
                            <GridView.ItemTemplate>
                                <DataTemplate>
                                    <Grid HorizontalAlignment="Left" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}">
                                        <StackPanel Orientation="Horizontal" Margin="10,10,0,0">
                                            <Image Source="{Binding Image}" Height="60" Width="60" VerticalAlignment="Center" Margin="0,0,10,0"/>
                                            <StackPanel Margin="0,0,0,0" Orientation="Vertical">
                                                <TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Style="{StaticResource ItemTitleStyle}" Width="200" VerticalAlignment="Center" Text="{Binding Title}" HorizontalAlignment="Left" FontFamily="Segoe UI" />
                                                <TextBlock TextWrapping="Wrap" Foreground="{StaticResource ApplicationForegroundThemeBrush}" Style="{StaticResource ItemSubtitleStyle}" Width="200" MaxHeight="20" VerticalAlignment="Center" Text="{Binding Category}" HorizontalAlignment="Left"/>
                                            </StackPanel>
                                        </StackPanel>
                                    </Grid>
                                </DataTemplate>
                            </GridView.ItemTemplate>
                            <GridView.GroupStyle>
                                <GroupStyle>
                                    <GroupStyle.HeaderTemplate>
                                        <DataTemplate>
                                            <Grid Margin="10">
                                                <TextBlock Text='{Binding Key}' Foreground="{StaticResource ApplicationForegroundThemeBrush}" FontSize="25" Margin="5" />
                                            </Grid>
                                        </DataTemplate>
                                    </GroupStyle.HeaderTemplate>
                                    <GroupStyle.Panel>
                                        <ItemsPanelTemplate>
                                            <VariableSizedWrapGrid Orientation="Vertical" Height="500" />
                                        </ItemsPanelTemplate>
                                    </GroupStyle.Panel>
                                </GroupStyle>
                            </GridView.GroupStyle>
                            <Button Visibility="Collapsed"/>
                        </GridView>
                    </SemanticZoom.ZoomedInView>
                </SemanticZoom>
            </Grid>
            <Button x:Name="Full_rubrics" HorizontalAlignment="Left" Height="31" Margin="700,424.5,0,0" VerticalAlignment="Top" Width="31" BorderBrush="{x:Null}" FontFamily="Symbol" FontSize="20" Visibility="Collapsed"  Click="Full_rubrics_Click">
                <Button.Background>
                    <ImageBrush ImageSource="Assets/full.jpg"/>
                </Button.Background>
            </Button>
            <Button x:Name="Rubrics_Back" Style="{StaticResource PreviousAppBarButtonStyle}" AutomationProperties.Name=""  Margin="0,521,0,10" Width="77" Click="Rubrics_Back_Click"/>
        </Grid>
        <Image x:Name="Im1" HorizontalAlignment="Left" Height="64" Margin="-99,29,0,0" VerticalAlignment="Top" Width="524" Source="Assets/logorubricsnew.png" Visibility="Collapsed"/>
        <Button x:Name="But1" Style="{StaticResource PreviousAppBarButtonStyle}" HorizontalAlignment="Left" Height="87" Margin="0,29,0,0" VerticalAlignment="Top" Width="91" AutomationProperties.Name="" Click="Button_Click_1" Visibility="Collapsed"/>
        <Grid x:Name="DopGrid" HorizontalAlignment="Left" Height="768" Margin="1185,0,0,0" VerticalAlignment="Top" Width="181" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}" Grid.ColumnSpan="2">
            <Line X1="5" Y1="00" X2="5" Y2="770" Stroke="White"></Line>
        </Grid>
        <Grid x:Name="GridAddMessage" Style="{StaticResource LayoutRootStyle}" HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366" Background="{StaticResource ComboBoxItemDisabledForegroundThemeBrush}" Grid.ColumnSpan="2" Visibility="Collapsed">
            <Grid HorizontalAlignment="Left" Height="532" Margin="442,122,0,0" VerticalAlignment="Top" Width="547" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}">
                <TextBlock HorizontalAlignment="Left" Height="24" Margin="27,78,0,0" TextWrapping="Wrap" Text="Рубрика" VerticalAlignment="Top" Width="86" FontSize="16"/>
                <ComboBox x:Name="ComboBoxRubric" HorizontalAlignment="Left" Height="32" Margin="27,102,0,0" VerticalAlignment="Top" Width="483" Loaded="ComboBoxRubric_Loaded"/>
                <TextBlock HorizontalAlignment="Left" Height="24" Margin="27,144,0,0" TextWrapping="Wrap" Text="Наименование сообщения" VerticalAlignment="Top" Width="215" FontSize="16"/>
                <Rectangle HorizontalAlignment="Left" Height="52" Stroke="Black" VerticalAlignment="Top" Width="547" Fill="#8C1F59BD"/>
                <TextBlock HorizontalAlignment="Left" Height="27" Margin="70,16,0,0" TextWrapping="Wrap" Text="Новое сообщение" VerticalAlignment="Top" Width="177" FontSize="18"/>
                <Image HorizontalAlignment="Left" Height="42" VerticalAlignment="Top" Width="45" Source="Assets/ADD.png" Margin="15,5,0,0"/>
                <TextBox x:Name="NameNewMessage" HorizontalAlignment="Left" Height="17" Margin="27,173,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="483" FontSize="14"/>
                <TextBlock HorizontalAlignment="Left" Height="24" Margin="27,215,0,0" TextWrapping="Wrap" Text="Текс сообщения" VerticalAlignment="Top" Width="215" FontSize="16"/>
                <TextBox x:Name="ContentMessageNew" HorizontalAlignment="Left" Height="188" Margin="27,244,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="483" FontSize="14"/>
                <Button Style="{StaticResource AddAppBarButtonStyle}" AutomationProperties.Name="Готово"  Margin="437,437,0,0" Width="73" Click="Button_Click_3"/>
                <Button Style="{StaticResource PreviousAppBarButtonStyle}" AutomationProperties.Name="Отмена"  Margin="359,437,0,0" Width="73" Click="Button_Click_2"/>
                <Button Style="{StaticResource AddAppBarButtonStyle}" AutomationProperties.Name="Добавить фото"  Margin="15,437,0,0" Width="113"/>
            </Grid>
        </Grid>
        <Grid x:Name="GridAddRubric" Style="{StaticResource LayoutRootStyle}" HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366" Background="{StaticResource ComboBoxItemDisabledForegroundThemeBrush}" Grid.ColumnSpan="2" Visibility="Collapsed">
            <Grid HorizontalAlignment="Left" Height="495" Margin="451,144,0,0" VerticalAlignment="Top" Width="547" Background="{StaticResource ComboBoxItemSelectedDisabledBackgroundThemeBrush}">
                <TextBlock HorizontalAlignment="Left" Height="24" Margin="32,235,0,0" TextWrapping="Wrap" Text="Наименование рубрики" VerticalAlignment="Top" Width="193" FontSize="16"/>
                <Rectangle HorizontalAlignment="Left" Height="52" Stroke="Black" VerticalAlignment="Top" Width="547" Fill="#8C1F59BD"/>
                <TextBlock HorizontalAlignment="Left" Height="27" Margin="70,16,0,0" TextWrapping="Wrap" Text="Новая рубрика" VerticalAlignment="Top" Width="177" FontSize="18"/>
                <Image HorizontalAlignment="Left" Height="42" VerticalAlignment="Top" Width="45" Source="Assets/ADD.png" Margin="15,5,0,0"/>
                <TextBox x:Name="NameNewRubric" HorizontalAlignment="Left" Height="124" Margin="32,264,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="483" FontSize="14"/>
                <Button Style="{StaticResource AddAppBarButtonStyle}" AutomationProperties.Name="Готово"  Margin="437,396,0,0" Width="73" Click="Button_Click_5"/>
                <Button Style="{StaticResource PreviousAppBarButtonStyle}" AutomationProperties.Name="Отмена"  Margin="359,396,0,-2" Width="73" Click="Button_Click_4"/>
                <Image HorizontalAlignment="Left" Height="120" Margin="391,106,0,0" VerticalAlignment="Top" Width="124" Source="Assets/Bloks/5.jpg" Stretch="Fill"/>

                <Button Style="{StaticResource TextPrimaryButtonStyle}" Margin="391,208,0,223" Height="48" >
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Добавить картинку" Margin="3,3,10,13" Style="{StaticResource GroupHeaderTextStyle}" FontSize="14" />
                    </StackPanel>
                </Button>
            </Grid>
        </Grid>

    </Grid>
</Page>